#ifndef PAPVIEW_HPP
#define PAPVIEW_HPP

#include <QDockWidget>

#include "command.hpp"
#include "pix.hpp"
#include "programmanagement.hpp"
#include "diagramscene.hpp"

namespace Ui {
    class PapView;
}

/**
* @brief
*
* @class PapView papview.hpp "papview.hpp"
*/
class PapView : public QDockWidget {
    Q_OBJECT
public:
    /**
    * @brief
    *
    * @fn PapView
    * @param parent
    */
    PapView(Pix *pix, QWidget *parent = 0);

    /**
    * @brief
    *
    * @fn ~PapView
    */
    ~PapView();

    /**
    * @brief Creates a Pap of the commands in the ProgramManagement
    *
    * @fn createPap
    */
    void createPap();

    void highlightCommand(int address);

    void unhighlightCommand(int address);

    void reset();

    void resetToProgramStart();

protected:
    /**
    * @brief
    *
    * @fn changeEvent
    * @param e
    */
    void changeEvent(QEvent *e);

private:
    Ui::PapView *ui;
    Pix *pix;
    ProgramManagement *programManagement;
    DiagramScene *diagramScene;
    QMap<int, DiagramItem*> diagramItems;
    QMap<int, QList<Command*> *> commandMap;
    int highlightedAddress;

private slots:
    void on_papScale_currentIndexChanged(int index);

public slots:
    void onProgramCounterChanged(int programCounter);
};

#endif // PAPVIEW_HPP
